Fix leak when first name in token is a vowel.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 3 May 2005 15:40:15 +0000 (15:40 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 3 May 2005 15:40:15 +0000 (15:40 +0000)
gpsbabel/mkshort.c

index fc3304ba150e8d7148c4afbe17edc71288e8895e..ce45907b8617e6de366e9375e9649b11f28fcb7c 100644 (file)
@@ -187,9 +187,10 @@ delete_last_vowel(int start, char *istring, int *replaced)
        *replaced = 0;
        for (l = strlen(istring); l > start; l--) {
                if (strchr(vowels, istring[l-1])) {
-                       char *ostring = xstrdup(istring);
+                       char *ostring;
                        /* If vowel is the first letter of a word, keep it.*/
                        if (istring[l-2] == ' ') continue;
+                       ostring = xstrdup(istring);
                        strncpy(&ostring[l-1], &istring[l], 1+strlen(istring)-l);
                        ostring[strlen(istring)-1] = 0;
                        *replaced = 1;